package com.example.blog.mapper;

import com.example.blog.model.BlogInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BlogInfoMapper {
    @Select("select id,title,content,user_id,update_time from `blog_info` where delete_flag=0 order by update_time desc")
    List<BlogInfo> select();

    @Select("select id,title,content,user_id,update_time from `blog_info` where id=#{id} and delete_flag=0")
    BlogInfo selectById(Integer id);

    @Insert("insert into `blog_info`(title,content,user_id) values (#{title},#{content},#{userID})")
    Integer insert(BlogInfo blogInfo);

    Integer update(BlogInfo blogInfo);

    /*@Insert("insert into `blog_info`(title,content,user_id) values(#{title},#{content},#{useId})")
    Integer insertBlog(BlogInfo blog);*/
}
